//
//  ByViewVideoPlayer.m
//  mijifen_ios
//
//  Created by 朱凯 on 2017/11/2.
//  Copyright © 2017年 itboye. All rights reserved.
//

#import "ByViewVideoPlayer.h"

@implementation ByViewVideoPlayer
{
    UIImageView *_thumbView;        // 视频缩略图
    UIView      *_playerBgView;     // 播放器的背景半透明视图
    UIButton    *_playButton;       // 播放按钮
}

- (instancetype)init {
    
    if (self = [super init]) {
        
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    
    _thumbView = [UIImageView new];
    _thumbView.userInteractionEnabled = true;
    _thumbView.image = [UIImage imageNamed:@"头视图背景"];
    [self addSubview:_thumbView];
    
    _playerBgView = [UIView new];
    _playerBgView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
    [_thumbView addSubview:_playerBgView];
    
    _playButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_playButton setImage:[UIImage imageNamed:@"播放-白"] forState:UIControlStateNormal];
    [_playButton setImage:[UIImage imageNamed:@""] forState:UIControlStateSelected];
    [_playButton addTarget:self action:@selector(play:) forControlEvents:UIControlEventTouchUpInside];
    [_thumbView addSubview:_playButton];
    
    [_thumbView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    [_playerBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_thumbView);
    }];
    [_playButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(60, 60));
        make.centerX.centerY.equalTo(_thumbView);
    }];
}

- (void)play:(UIButton *)button {
    
    
}

@end
